{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2014_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}10 Oct 2021, 14:48:06

{com}. do "C:\Users\JUNGYE~1\AppData\Local\Temp\STD3410_000000.tmp"
{txt}
{com}. import delimited "C:\Users\Jungyeon PARK\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\FEVS\FEVS_2010-2019\FEVS2014_PRDF.csv
{res}{text}(100 vars, 392,752 obs)

{com}. 
. svyset [pweight=postwt]

      {txt}pweight:{col 16}{res}postwt
          {txt}VCE:{col 16}{res}linearized
  {txt}Single unit:{col 16}{res}missing
     {txt}Strata 1:{col 16}<one>
         SU 1:{col 16}<observations>
        FPC 1:{col 16}<zero>
{p2colreset}{...}

{com}. 
. drop if q17=="X"
{txt}(16,950 observations deleted)

{com}. 
. drop if q17==""
{txt}(2,708 observations deleted)

{com}. 
. drop if q37=="X"
{txt}(17,214 observations deleted)

{com}. 
. drop if q37==""
{txt}(8,948 observations deleted)

{com}. 
. drop if q38=="X"
{txt}(16,630 observations deleted)

{com}. 
. drop if q38==""
{txt}(3,530 observations deleted)

{com}. 
. destring q17, replace
{txt}q17: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q37, replace
{txt}q37: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q38, replace
{txt}q38: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. svy linearized : gsem (FAIRNESS -> q17, family(ordinal) link(logit)) (FAIRNESS -> q37, family(ordinal) link(logit)) (FAIRNESS -> q38, family(ordinal) link(logit)), covstruct(_lexogenous, diagonal) latent(FAIRNESS) nocapslatent
{txt}(running gsem on estimation sample)
{res}
{txt}Survey: Generalized structural equation model

{col 1}Number of strata{col 20}= {res}        1{txt}{col 49}Number of obs{col 67}= {res}   326,772
{txt}{col 1}Number of PSUs{col 20}= {res}  326,772{txt}{col 49}Population size{col 67}={res}  1,477,782
{txt}{col 49}Design df{col 67}= {res}   326,771

{txt}Response{col 16}: {res}q17
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q37
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q38
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{p 0 7}{space 1}{text:( 1)}{space 1} [q17]FAIRNESS = 1{p_end}
{txt}{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}  Linearized
{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q17           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2}        1{col 27}{txt}  (constrained)
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q37           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 1.806565{col 27}{space 2} .0175613{col 38}{space 1}  102.87{col 47}{space 3}0.000{col 55}{space 4} 1.772146{col 68}{space 3} 1.840985
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q38           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 2.044932{col 27}{space 2} .0241842{col 38}{space 1}   84.56{col 47}{space 3}0.000{col 55}{space 4} 1.997531{col 68}{space 3} 2.092332
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q17          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-3.330468{col 27}{space 2} .0139829{col 55}{space 4}-3.357874{col 68}{space 3}-3.303061
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.182353{col 27}{space 2} .0107888{col 55}{space 4}-2.203498{col 68}{space 3}-2.161207
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.7448812{col 27}{space 2} .0084153{col 55}{space 4} -.761375{col 68}{space 3}-.7283874
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 1.832488{col 27}{space 2}  .010341{col 55}{space 4}  1.81222{col 68}{space 3} 1.852756
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q37          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2} -4.48359{col 27}{space 2} .0326678{col 55}{space 4}-4.547618{col 68}{space 3}-4.419562
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.713375{col 27}{space 2} .0223449{col 55}{space 4}-2.757171{col 68}{space 3} -2.66958
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.3185224{col 27}{space 2} .0126897{col 55}{space 4}-.3433939{col 68}{space 3}-.2936509
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 3.837143{col 27}{space 2} .0284813{col 55}{space 4}  3.78132{col 68}{space 3} 3.892965
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q38          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-6.256732{col 27}{space 2} .0548243{col 55}{space 4}-6.364186{col 68}{space 3}-6.149278
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-4.628011{col 27}{space 2} .0418619{col 55}{space 4}-4.710059{col 68}{space 3}-4.545962
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-1.714435{col 27}{space 2} .0204671{col 55}{space 4} -1.75455{col 68}{space 3} -1.67432
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 3.160736{col 27}{space 2} .0299878{col 55}{space 4}  3.10196{col 68}{space 3} 3.219511
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}var(FAIRNESS){c |}{col 15}{res}{space 2} 4.072817{col 27}{space 2} .0448875{col 55}{space 4} 3.985782{col 68}{space 3} 4.161752
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. predict fairnessgsem, latent(FAIRNESS)
{txt}(option {bf:ebmeans} assumed)
{res}{txt}(using 7 quadrature points)

{com}. 
. egen average_fairnessgsem = mean (fairnessgsem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnessgsem = mean (fairnessgsem), by (plevel1)
{txt}
{com}. 
. egen sub2_average_fairnessgsem = mean (fairnessgsem), by (plevel2)
{txt}
{com}. 
. svy linearized : sem (FAIRNESSSEM -> q38 q37 q17), covstruct(_lexogenous, diagonal) standardized latent(FAIRNESSSEM) nocapslatent
{txt}(running sem on estimation sample)
{res}
{txt}{col 1}Survey: Structural equation model{col 49}Number of obs{col 67}= {res}   326,772
{txt}{col 1}Number of strata{col 22}= {res}        1{txt}{col 49}Population size{col 67}={res}  1,477,782
{txt}{col 1}Number of PSUs{col 22}= {res}  326,772{txt}{col 49}Design df{col 67}= {res}   326,771

{p 0 7}{space 1}{text:( 1)}{space 1} [q38]FAIRNESSSEM = 1{p_end}
{txt}{hline 16}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 17}{c |}{col 29}  Linearized
{col 1}   Standardized{col 17}{c |}      Coef.{col 29}   Std. Err.{col 41}      t{col 49}   P>|t|{col 57}     [95% Con{col 70}f. Interval]
{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}{res}Measurement    {col 17}{txt}{c |}
{space 2}{col 3}q38          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .8555534{col 29}{space 2} .0016254{col 40}{space 1}  526.38{col 49}{space 3}0.000{col 57}{space 4} .8523677{col 70}{space 3}  .858739
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 3.222702{col 29}{space 2} .0078678{col 40}{space 1}  409.61{col 49}{space 3}0.000{col 57}{space 4} 3.207281{col 70}{space 3} 3.238122
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q37          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2}  .850108{col 29}{space 2}  .001661{col 40}{space 1}  511.79{col 49}{space 3}0.000{col 57}{space 4} .8468524{col 70}{space 3} .8533636
{txt}{space 10}_cons {c |}{col 17}{res}{space 2}  2.64956{col 29}{space 2} .0054539{col 40}{space 1}  485.81{col 49}{space 3}0.000{col 57}{space 4}  2.63887{col 70}{space 3} 2.660249
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q17          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .7041572{col 29}{space 2} .0019932{col 40}{space 1}  353.27{col 49}{space 3}0.000{col 57}{space 4} .7002506{col 70}{space 3} .7080639
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 2.863965{col 29}{space 2} .0063423{col 40}{space 1}  451.56{col 49}{space 3}0.000{col 57}{space 4} 2.851534{col 70}{space 3} 2.876396
{txt}{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}var(e.q38){c |}{col 17}{res}{space 2} .2680284{col 29}{space 2} .0027812{col 57}{space 4} .2626325{col 70}{space 3} .2735352
{txt}{space 6}var(e.q37){c |}{col 17}{res}{space 2} .2773164{col 29}{space 2} .0028241{col 57}{space 4}  .271836{col 70}{space 3} .2829072
{txt}{space 6}var(e.q17){c |}{col 17}{res}{space 2} .5041626{col 29}{space 2} .0028071{col 57}{space 4} .4986906{col 70}{space 3} .5096946
{txt}var(FAIRNESSSEM){c |}{col 17}{res}{space 2}        1{col 29}{space 2}        .{col 57}{space 4}        .{col 70}{space 3}        .
{txt}{hline 16}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. estat gof, stats(all)
{res}
{txt}{hline 21}{c TT}{hline 54}
{lalign 21:Fit statistic}{c |}      Value   Description
{hline 21}{c +}{hline 54}
{lalign 21:Size of residuals}{c |}
{ralign 20:SRMR} {c |} {res}{ralign 10:     0.000}{txt}   Standardized root mean squared residual
{ralign 20:CD} {c |} {res}{ralign 10:     0.863}{txt}   Coefficient of determination
{hline 21}{c BT}{hline 54}
{p 0 2 2 75}Note: model was fit with{txt} svy: prefix; only stats(residuals) valid.{p_end}

{com}. 
. predict fairnesssem, latent(FAIRNESSSEM)
{res}{txt}
{com}. 
. egen average_fairnesssem = mean (fairnesssem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnesssem = mean (fairnesssem), by (plevel1)
{txt}
{com}. 
. egen sub2_average_fairnesssem = mean (fairnesssem), by (plevel2)
{txt}
{com}. 
. correlate fairnessgsem fairnesssem
{txt}(obs=326,772)

             {c |} fai~gsem fai~ssem
{hline 13}{c +}{hline 18}
fairnessgsem {c |}{res}   1.0000
 {txt}fairnesssem {c |}{res}   0.9811   1.0000

{txt}
{com}. 
{txt}end of do-file

{com}. save "C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2014_FEVS_DATA.dta"
{txt}file C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2014_FEVS_DATA.dta saved

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2014_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}10 Oct 2021, 14:55:27
{txt}{.-}
{smcl}
{txt}{sf}{ul off}